//
//  LoginCodeView.m
//  LifeBox
//
//  Created by Lucky on 2019/11/11.
//  Copyright © 2019 Lucky. All rights reserved.
//

#import "LoginCodeView.h"

@implementation LoginCodeView

#pragma mark - 初始化
- (instancetype)init {
    self = [super init];
    if (self) {
        [self createUI];
      
    }
    return self;
}

#pragma mark - 创建UI
- (void)createUI {
    self.backgroundColor = UIColor.whiteColor;
    [self ug_radius:4];
    [self addSubview:self.lineView];
    [self addSubview:self.phoneTF];
    [self addSubview:self.codeBtn];
    [self addSubview:self.codeTF];

}
-(UGTextField *)phoneTF{
    if (!_phoneTF) {
        _phoneTF = [UGTextField new];
        _phoneTF.textColor = COLOR_23;
        _phoneTF.borderStyle = UITextBorderStyleNone;
        _phoneTF.clearButtonMode = UITextFieldViewModeWhileEditing;
        _phoneTF.font = FONT_SYS16;
        _phoneTF.ug_maximumLimit = 11;
        _phoneTF.inputType = InputTypeNumber;
        _phoneTF.offset = KPAND_MIN;
        _phoneTF.placeholder = @"请输入手机号";
    }
    return _phoneTF;
}

-(UGTextField *)codeTF{
    if (!_codeTF) {
        _codeTF = [UGTextField new];
        _codeTF.borderStyle = UITextBorderStyleNone;
        _codeTF.textColor = COLOR_23;
        _codeTF.clearButtonMode = UITextFieldViewModeWhileEditing;
        _codeTF.keyboardType = UIKeyboardTypeNumberPad;
        _codeTF.font = FONT_SYS16;
        _codeTF.placeholder = @"验证码";
        _codeTF.ug_maximumLimit = 6;
        _codeTF.offset = KPAND_MIN;
        _codeTF.inputType = InputTypeNumber;
   
    }
    return _codeTF;
}

-(UIButton *)codeBtn{
    if (!_codeBtn) {
        _codeBtn = [UIButton new];
        _codeBtn.titleLabel.font = FONT_SYS12;
        [_codeBtn setTitleColor:COLORPRIMARY forState:UIControlStateNormal];
        [_codeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
        _codeBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
    }
    return _codeBtn;
}
-(UIView *)lineView{
    if (!_lineView) {
        _lineView = [UIView new];
        _lineView.backgroundColor = COLOR_EE;
    }
    return _lineView;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    [_phoneTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top);
        make.left.mas_equalTo(KAutoAcale(5));
        make.right.mas_equalTo(KAutoAcale(5));
        make.bottom.mas_equalTo(self.lineView);
    }];
    
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
    
    [_codeTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.mas_bottom);
        make.left.mas_equalTo(KAutoAcale(5));
        make.width.mas_greaterThanOrEqualTo(KAutoAcale(200));
        make.top.mas_equalTo(self.lineView);
    }];
    [_codeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.codeTF);
        make.right.mas_equalTo(-KPAND_MID);
    }];
}




@end
